﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="CategoryManage.aspx.cs" Inherits="FYPHP.CategoryManage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<h2>Add New Category</h2>
<table cellpadding="5" cellspacing="5" width="722" border="1px solid #ffffff" align="center" style="border-collapse: collapse; border-color: #aaaaaa; text-align: center">
<tr><td width="150px">Category Name</td><td width="5px" style="border-left: 1px solid #fff;">:</td><td align="left">
    <asp:TextBox ID="txtCat" runat="server"></asp:TextBox></td>
</tr>
<tr><td colspan="2"></td><td align="left">
    <asp:Button ID="btnAdd" runat="server" Text="Add" onclick="btnAdd_Click" />
    </td></tr></table>

    <br />
<h2>Category Manage</h2>
<script type="text/javascript">    var num = 0; </script>
   <asp:Repeater ID="ItemList" runat="server" EnableViewState="False" 
        onitemcommand="ItemList_ItemCommand">
       
<HeaderTemplate>
<table cellpadding="5" cellspacing="5" width="722" border="1px solid #ffffff" align="center" style="border-collapse: collapse; border-color: #aaaaaa; text-align: center">
 <tr style="background-color: #eee; font-weight: bold;"><td width="30px">No.</td><td>Category</td><td width="120">Actions</td></tr>

</HeaderTemplate>

<ItemTemplate>
     <tr>
            <td><script type="text/javascript">num += 1; document.write(num);</script></td>
            <td style="text-align: left"><%#DataBinder.Eval(Container.DataItem, "cat_name" ) %></td>
            <td><asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="EditCategory" 
        CommandArgument='<%# Eval("cat_id").ToString() %>' />
        <asp:Button ID="btnDelete" runat="server" Text="Delete" CommandName="DeleteCategory" OnClientClick="return confirm('Are you sure you want to delete this category?');" 
        CommandArgument='<%# Eval("cat_id").ToString() %>' /></td>
        </tr>
       
   </ItemTemplate>

   <FooterTemplate>
   
    </table>
    </FooterTemplate>
</asp:Repeater>
</asp:Content>
